package com.example.wkable.exoplayer.player

import android.net.Uri

interface BasePlayer<T> {
    /**
     * 如果当前视频播放处于暂停状态则继续播放，否则什么都不做
     */
    fun resume()

    /**
     * 如果视频正处于播放状态，则暂停播放，否则什么都不做
     */
    fun pause()

    /**
     * 销毁播放器，释放资源
     */
    fun release()

    /**
     * 开始播放
     */
    fun start(url: Uri, loop: Boolean)

    fun seekTo(positionMs: Long)

    /**
     * Returns the duration of the current content window or ad in milliseconds, or {@link
     * C#TIME_UNSET} if the duration is not known.
     */
    fun getDuration(): Long

    fun addListener(listener: EventListener)

    fun removeListener(listener: EventListener)
    interface EventListener {
        fun onStateChange(state: Int)

        fun onError(error: String)

        fun onProgress(ratio: Float)
    }
}